<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <p>{{msg}}</p>
      <child-component></child-component>
    </div>
    <script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
    <script>
      var parentComponent = new Vue({
        el: "#app",
        data: { msg: "hello" },
        beforeCreate() {
          console.log("parentComponent.beforeCreate");
        },
        created() {
          console.log("parentComponent.created");
        },
        beforeMount() {
          console.log("parentComponent.beforeMount");
        },
        mounted() {
          console.log("parentComponent.mounted");
        },
        beforeUpdate() {
          console.log("parentComponent.beforeUpdate");
        },
        updated() {
          console.log("parentComponent.updated");
        },
        beforeDestroy() {
          console.log("parentComponent.beforeDestroy");
        },
        destroyed() {
          console.log("parentComponent.destroyed");
        },
        components: {
          "child-component": {
            data: () => ({ count: 0 }),
            methods: {
              increase() {
                this.count++;
              },
            },
            template: `<button @click="increase">{{count}}</button>`,
            beforeCreate() {
              console.log("childComponent.beforeCreate");
            },
            created() {
              console.log("childComponent.created");
            },
            beforeMount() {
              console.log("childComponent.beforeMount");
            },
            mounted() {
              console.log("childComponent.mounted");
            },
            beforeUpdate() {
              console.log("childComponent.beforeUpdate");
            },
            updated() {
              console.log("childComponent.updated");
            },
            beforeDestroy() {
              console.log("childComponent.beforeDestroy");
            },
            destroyed() {
              console.log("childComponent.destroyed");
            },
          },
        },
      });
    </script>
  </body>
</html>
